﻿using System;
using System.Configuration;
using MSAcademic.v2.Infrastructure.Article;
using MSAcademic.v2.Infrastructure.Picture;

namespace MSAcademic.v2.Web.Areas.Admin.Models.Picture
{
     public partial class EditArticleThumbnailPictureViewModel
     {
        public int ArticleId { get; set; }
        public string CroppedThumbnailPictureUrl { get; set; }
        public string OriginalUrl { get; set; }

        public double ThumbnailPictureWidth
        {
            get { return Convert.ToInt32(ConfigurationManager.AppSettings["ArticleThumbnailPictureWidth"]); }
        }

        public double ThumbnailPictureHeight
        {
            get { return Convert.ToInt32(ConfigurationManager.AppSettings["ArticleThumbnailPictureHeight"]); }
        }
     }

     public partial class EditArticleThumbnailPictureViewModel
     {
         public string ThumbnailPictureUrl
         {
             get
             {
                 if (_thumbnailUrl == null)
                 {
                     _thumbnailUrl = new Lazy<string>(() => _PictureService.GetOriginalPictureUrl(_articleQueries.GetArticle(ArticleId).PictureUrlThumbnail));
                 }
                 return _thumbnailUrl.Value;
             }
         }
         private Lazy<string> _thumbnailUrl;
     }
     public partial class EditArticleThumbnailPictureViewModel
     {
         public IArticleQueries _articleQueries { get; set; }
         public IPictureService _PictureService { get; set; }
         public EditArticleThumbnailPictureViewModel (IArticleQueries articleQueries,IPictureService PictureService )
         {
             _articleQueries = articleQueries;
             _PictureService = PictureService;
         }
         public EditArticleThumbnailPictureViewModel()
         {
             
         }
     }

}